<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #flex{
            width: 500px;
            height: 500px;
            background-color: #000; 

            display: flex; 
            /* flex-direction: column; */
            /* 水平居中 - center  space-between space-around*/
            justify-content:center;

            /* 垂直居中 */
            align-items: center;
        }
        p {
            flex:1;
            /* width: 100px; */
            height: 100px;
        }

        p:nth-child(1) {
            background-color: rebeccapurple;
        }

        p:nth-child(2) {
            background-color: blue;
        }

        p:nth-child(3) {
            background-color: green;
        }
        p:nth-child(4) {
            background-color: blue;
        }

        /* 三排 7列 */
        ul{
            display: flex;
            flex-wrap:wrap
        }
        li{
            list-style: none;
            text-align: center;
            width:14.285%
        }
    </style>
</head>

<body>
    <!-- ul>li{新闻}*21 tab -->
    <ul>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li> 
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li>
        <li>新闻</li> 
    </ul>
    <div id="flex">
        <p>child 1</p>
        <p>child 2</p>
        <p>child 3</p>
        <p>child 4</p>
    </div>
</body>

</html>